add_executable(render-qml-to-texture WIN32 MACOSX_BUNDLE
    main.cpp
    planematerial.cpp planematerial.h
)
qt_add_qml_module(render-qml-to-texture
    URI render_qml_to_texture
    VERSION ${PROJECT_VERSION}
    QML_FILES
        OffscreenGui.qml
        TextRectangle.qml
    RESOURCES
        shaders/es2/texturing.frag
        shaders/es2/texturing.vert
        shaders/gl3/texturing.frag
        shaders/gl3/texturing.vert
    NO_RESOURCE_TARGET_PATH
)

target_link_libraries(render-qml-to-texture PRIVATE
    3dquickscene2d
    Qt${QT_VERSION_MAJOR}::3DCore
    Qt${QT_VERSION_MAJOR}::3DExtras
    Qt${QT_VERSION_MAJOR}::3DInput
    Qt${QT_VERSION_MAJOR}::3DQuick
    Qt${QT_VERSION_MAJOR}::3DQuickRender
    Qt${QT_VERSION_MAJOR}::3DRender
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Gui
    Qt${QT_VERSION_MAJOR}::Qml
    Qt${QT_VERSION_MAJOR}::Quick
)

install(TARGETS render-qml-to-texture
    BUNDLE DESTINATION .
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Consider using qt_generate_deploy_app_script() for app deployment if
# the project can use Qt 6.3. In that case rerun qmake2cmake with
# --min-qt-version=6.3.
